home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-06 | 1.4 KB | 73 lines | [TEXT/MSET] |
- \ 06Nov94 dbh updated to 2.5 syntax
-
- (*
-
- We decide that a picture is a lot like a rectangle, so we make class picture
- a subclass of rect+ along with our nullselect class so we can use picture objects
- in our selection framework. Also we use class OwnerObj as a superclass so we
- can easily implement scrolling.
-
- We are defaulting to a PICT resource ID of 400. This won't
- work of course unless we have such a resource available.
- You should make sure you have placed the resource file
- Selection.rsrc into your Mops ƒ folder.
-
- We provide the expected behavior and methods, and also provide a normal:
- method which will set the rect+ ivar data to match the PICT resource.
- Also we provide a frame: method to draw a black border around the
- picture, if desired.
-
- *)
-
- :class picture super{ rect+ nullSelect OwnerObj }
- resource+ res
-
- :m set: ( resID -- )
- 'type PICT swap set: res ;m
-
- :m classinit:
- 400 set: self ;m
-
- :m new: ( wptr -- )
- drop
- getnew: res
- normal: [self] ;m
-
- :m draw:
- get: res ( PicHandle)
- self ( dstRect)
- call DrawPicture ;m
-
- :m normal: { \ prect -- }
- ptr: res 2 + -> prect
- prect width: rect+ setwidth: super
- prect height: rect+ setheight: super
- ;m
-
- :m frame:
- draw: self
- call PenNormal
- draw: super ;m
-
- :m release:
- release: res ;m
-
- ;class
-
-
- endload
-
- *** EXAMPLE USE
-
- \ Make sure that the resource file Selection.rsrc has been placed into your Mops ƒ folder.
-
-
- " Selection.rsrc" OpenResFile
-
- selwindow w
- test: w
-
- picture p
- p add: w
-
-